package com.dkd.system.utils;
import com.aliyun.docmind_api20220711.models.*;
import com.aliyun.teaopenapi.models.Config;
import com.aliyun.docmind_api20220711.Client;
import com.aliyun.teautil.models.RuntimeOptions;
import java.io.File;
import java.io.FileInputStream;
import com.alibaba.fastjson.JSON;

public class PDFTOEXCEL {
    public static void main(String[] args) throws Exception {
        submit();
    }
    public static void submit() throws Exception {
        String accessKeyId = "LTAI5tH859ntEkQLzum1Ah95";
        String accessKeySecret = "HMnbc0i2igFOIQcQBqti2FPXrpLQJt";
        // 使用默认凭证初始化Credentials Client。
//        com.aliyun.credentials.Client credentialClient = new com.aliyun.credentials.Client();
        Config config = new Config()
                // 通过credentials获取配置中的AccessKey ID
                .setAccessKeyId(accessKeyId)
                // 通过credentials获取配置中的AccessKey Secret
                .setAccessKeySecret(accessKeySecret);
        // 访问的域名，支持ipv4和ipv6两种方式，ipv6请使用docmind-api-dualstack.cn-hangzhou.aliyuncs.com
        config.endpoint = "docmind-api.cn-hangzhou.aliyuncs.com";
        Client client = new Client(config);
        // 创建RuntimeObject实例并设置运行参数
        RuntimeOptions runtime = new RuntimeOptions();
        SubmitConvertPdfToExcelJobAdvanceRequest advanceRequest = new SubmitConvertPdfToExcelJobAdvanceRequest();
        File file = new File("C:\\Users\\褚永硕\\Desktop\\测试使用.pdf");
        advanceRequest.fileUrlObject = new FileInputStream(file);
        advanceRequest.fileName = "example.pdf";
        // 4 发起请求并处理应答或异常。
        SubmitConvertPdfToExcelJobResponse response = client.submitConvertPdfToExcelJobAdvance(advanceRequest, runtime);
        System.out.println(JSON.toJSON(response.getBody()));
    }
}
